<ui:composition template="/WEB-INF/templates/main-template.xhtml" 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" >
	
	<ui:param name="pageName" value="Asset Handover Form" />
	
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml"/>
	</ui:define>
	<ui:define name="content">
		
		<h:outputText value="Asset Handover Form" styleClass="outputTextTitle"/>	
		<h:form> 
		 <p:growl/>
		 
		 <p:panel header="Asset Handover Form"> 
		 	<h:panelGrid columns="4" > 
            	    
		    	    <h:outputLabel value="Module" style="font-weight:bold;"/>
		    	    <h:outputLabel value="Employee Code" style="font-weight:bold;float:left;"/>
		    	    <h:outputLabel value="Employee Name" style="font-weight:bold;float:left;"/>
		    	    <h:outputLabel value="" />
		    	    
		    	    <p:selectOneMenu value="#{assetHandOverBean.selectedModule}" style="width: 160px;">
			              <f:selectItem itemLabel="--Select One--" itemValue="" />
			              <f:selectItems value="#{assetHandOverBean.modulesMap}" />
		            </p:selectOneMenu>
		    	   
		    	    <p:inputText id="employeeCode" value="#{assetHandOverBean.employeeCode}"/>
		    	    
		    	    <p:inputText id="employeeName" value="#{assetHandOverBean.employeeName}"/>
		    	    		           
		            <p:commandButton id="Search" value="Search" update="@form"  action="#{assetHandOverBean.searchHandoverAssets}"  />
             </h:panelGrid>
             
             <!-- Search Result DataList -->
			    <p:dataTable paginator="true" rows="20" id="handoverAssets" value="#{assetHandOverBean.assetRequestList}" var="asset" rendered="#{assetHandOverBean.renderHandoverList}">  
	  
		            <p:column headerText="Asset Code"> 
		                <h:outputText value="#{asset.assetReferenceCode}" />
		            </p:column>  
		            
		            <p:column headerText="Request Date"> 
		              	<h:outputText value="#{asset.requestDate}"  > 
		              		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assetHandOverBean.timeZone}"/>
		              	</h:outputText> 	               
		            </p:column>  
		  
		            <p:column headerText="Employee Name"> 
		                <h:outputText value="#{asset.employee.firstName} #{asset.employee.lastName}" />  
		            </p:column> 
		            
		            <p:column headerText="Email"> 
		                <h:outputText value="#{asset.employee.email}" />  
		            </p:column> 
		            
		            <p:column headerText="Contact No"> 
		                <h:outputText value="#{asset.employee.telephone}" />  
		            </p:column> 
		            
		            <p:column headerText="Module Name">
		                <h:outputText value="#{asset.employee.moduleName}" />  
		            </p:column>  
		            
		             <p:column headerText="Handover"> 
		            	<p:commandButton actionListener="#{assetHandOverBean.assetHandoverAction}" value="Handover" >
							<f:param id="assetCode" name="assetCode" value="#{asset.assetReferenceCode}" />							
						</p:commandButton>						
		            </p:column>
		            
		 
		        		          
	             </p:dataTable>
		 
		 </p:panel>
     </h:form>
	</ui:define>
	
</ui:composition>
